package com.Jano.controller;/**
 * @ClassName : loginController
 * @Description :
 * @Author : Jano
 * @Date: 2022-07-24 19:15
 */

import com.Jano.dto.JsonResult;
import com.Jano.entity.User;
import com.Jano.service.loginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author zoumaoji
 * @date 2022/07/24 19:15
 **/

@RestController
public class loginController {
    @Autowired
    loginService loginService;


    @RequestMapping("user/login")
    public JsonResult login(@RequestBody User user){
        //登陆
        JsonResult loginResult = loginService.login(user);
        return loginResult;
    }

    @RequestMapping("user/logout")
    public JsonResult loginOut(){
        //退出
        JsonResult loginResult = loginService.logout();
        return loginResult;
    }
}
